import request from "@/utils/request.js";

export function personnelLogin(data) {
	return request.post('delivery/personnel/login', data, {});
}
// 配送员订单管理
export function personnelOrdermanage(data) {
	return request.post('delivery/personnel/order/manage', data, {});
}
/**
 * @Description:查询门店订单列表
 * @author: YXY
 * @param （0：待支付，1：待发货（快递状态下）,2：部分发货， 3：待核销（门店自提），4：待收货（快递状态下）,5：已收货（快递状态下）,6：已完成，9：已取消10：待配送（同城配送的状态） 11：配送中（同城配送的状态） 12：已送达（同城配送的状态））
 * @return 
 * @createTime: 2025-03-14 10:17:07
 * @Copyright by 精颜科技有限公司
 */
export function roomOrderList(data) {
	return request.post('sale/room/order/list', data, {});
}

/**
 * 订单详情
 * @param string uni
 */
export function getOrderDetail(uni) {
	return request.get('order/detail/' + uni);
}
/**
 * 将字符串 转base64
 * @param object data
 */
export function strToBase64Api(data) {
	return request.post('qrcode/str/to/base64', data);
}

/**
 * @Description:配送员扫门店订单二维码
 * @author: YXY
 * @param :orderNo
 * @return 
 * @createTime: 2025-03-17 17:09:05
 * @Copyright by 精颜科技有限公司
 */
export function personnelScanCode(data) {
	return request.post('delivery/personnel/scan/code', data);
}


/**
 * @Description:配送员已送达
 * @author: YXY
 * @param:orderNo 
 * @return 
 * @createTime: 2025-03-18 10:18:03
 * @Copyright by 精颜科技有限公司
 */
export function personnelDelivered(orderNo) {
	return request.get('delivery/personnel/delivered/' + orderNo);
}

/**
 * @Description:查询门店商品信息列表
 * @author: YXY
 * @param 
 * @return 
 * @createTime: 2025-03-18 11:45:55
 * @Copyright by 精颜科技有限公司
 */
export function saleProductlist(data) {
	return request.post('sale/room/product/list', data);
}

/**
 * 获取产品详情
 * @param int id
 * 
 */
export function getProductDetail(id, marketingType = 0, type = 0, groupActivityId = '') {
	return request.get(
		`product/detail?id=${id}&marketingType=${marketingType}&type=${type}&groupActivityId=${groupActivityId}`, {},
	);
}

/**
 * @Description:调整订单
 * @author: YXY
 * @param  
 * @return 
 * @createTime: 2025-03-19 17:15:19
 * @Copyright by 精颜科技有限公司
 */
export function personnelAdjustOrder(data) {
	return request.post('delivery/personnel/adjust/order', data);
}

// 核销码核销跳转订单详情
export function getVerification(data) {
	return request.post('sale/room/get/verification', data);
}
// 核销码核销订单
export function verification(data) {
	return request.post('sale/room/verification', data);
}

// 门店查询退款订单
export function refundList(data) {
	return request.get('refund/list', data);
}

// 退款单审核
export function orderAuditApi(data) {
	return request.post('sale/room/audit', data);
}


// 退款单拒绝
export function orderRejectApi(data) {
	return request.post('sale/room/refund/reject', data);
}
// 发送定位 - 已注释，避免iOS审核问题
// export function personnelSendLoc(data) {
// 	return request.post('delivery/personnel/send/location', data);
// }
// 查询配送员是否有待配送订单
export function personnelToDelivered(data) {
	return request.get('delivery/personnel/to/delivered/' + data);
}
//查询调货详情列表
export function platformTransfer(data) {
	return request.get('sale/room/list', data);
}
// 确认调货
export function saleRoomisSure(data) {
	return request.get(`sale/room/isSure/` + data);
} 
// 获取收款码
export function getMoneyQrCode(data) {
	return request.post(`pay/payment`, data);
} 
//拒接收货-带原因 /api/front/order/orderCancel
export function refusedOrder(data){
	return request.post(`order/orderCancel`,data)
}
//配送员退款订单列表  /api/front/delivery/personnel/list
export function personnelReturnList(data){
	return request.get(`delivery/personnel/list`,data)
}
// 拒绝(同意)退款单-只能配送员拒绝 /api/front/refund/refuse/refund
export function refuseRefund(data){
	return request.post(`refund/refuse/refund`,data)
}

// 退款单详情
export function orderRefundInfoApi(refundOrderNo) {
	return request.get(`refund/detail/${refundOrderNo}`)
}
// 查询订单微信支付结果   /api/front/pay/query/wechat/pay/result/{orderNo}
export function queryWechatPayResult(orderNo){
	return request.get(`pay/query/wechat/pay/result/${orderNo}`)
}
//查询订单支付宝支付结果 /api/front/pay/query/ali/pay/result/{orderNo}
export function queryAliPayResult(orderNo){
	return request.get(`pay/query/ali/pay/result/${orderNo}`)
}
// 确认上门  /api/front/delivery/personnel/confirm/{orderNo}
export function confirmDoor(orderNo){
	return request.get(`delivery/personnel/confirm/${orderNo}`)
}
//门店退款订单列表  /api/front/sale/room/refund/order/list
export function saleRoomRefundOrderList(data){
	return request.post(`sale/room/refund/order/list`,data)
}
//门店出入库单分页列表 sale/room/list
export function saleRoomList(data){
	return request.post(`sale/room/list`,data)
}
//门店出入库单详情 ///api/front/sale/room/info
export function saleRoomInfo(data){
	return request.post(`sale/room/info`,data)
}
//门店出入库单详情操作(取消-提交) /api/front/sale/room/operate
export function saleRoomOperate(data){
	return request.post(`sale/room/operate`,data)
}

// 盘点列表
export function getStocktasking(data){
	return request.get(`sale/room/stocktaking/task/page`, data)
}
	
// 盘点列表详情
export function getStocktaskingDetail(data){
	return request.get(`sale/room/stocktaking/task/info`, data)
}
	
// 提交库存盘点详情数据
export function submitStocktasking(data){
	return request.post(`sale/room/stocktaking/detail/submit`, data)
}
//根据商品id查询规格列表  /api/front/product/list/specs/{productId}
export function getProductSpecs(productId){
	return request.get(`product/list/specs/${productId}`)
}
//确认出库  /api/front/sale/room/isSure/out
export function saleRoomIsSureOut(data){
	return request.post(`sale/room/isSure/out`,data)
}

// 获取门店统计订单趋势图
export function getDataKline(data){
	return request.get(`sale/room/room/dashboard/charts/order`, data)
}

// 获取门店统计基础数据
export function getBasicInfo(data){
	return request.get(`sale/room/room/dashboard/data/basic`, data)
}


// 门店统计订单分页
export function getOrderList(data){
	return request.get(`sale/room/room/dashboard/page/order`, data)
}

//备货详情 /api/front/sale/room/stock_up/details/{orderNo}
export function getStockUpDetails(orderNo){
	return request.get(`sale/room/stock_up/details/${orderNo}`)
}
// 门店站内信
export function getMsgList(data){
	return request.get(`sale/room/notice/internal/page`, data)
}

// 获取门店汇总待办数据
export function getInfo(data){
	return request.get(`sale/room/summary/data`, data)
}

export function read(id){
	return request.post(`sale/room/notice/internal/read/${id}`)
}
// 延长配送时间 sale/room/order/delivery/time/extend
export function extendDeliveryTime(data){
	return request.post(`sale/room/order/delivery/time/extend`, data)
}








